package com.zrentech.order.data.dbhelper.builder;

import android.content.ContentValues;
import android.database.Cursor;

import com.zrentech.order.data.busibean.TableTypeBean;
import com.zrentech.order.data.dbhelper.DatabaseBuilder;

/**
 * 
 * 提供关于台位类型的创建和解析方面的功能
 * 
 * @author Leon
 */

public class TableTypeDBuilder extends DatabaseBuilder<TableTypeBean> {

	public static final String TRACK_ID = "id";
	public static final String TRACK_NAME = "name";

	@Override
	public TableTypeBean build(Cursor query) {
		int columnId = query.getColumnIndex(TRACK_ID);
		int columnName = query.getColumnIndex(TRACK_NAME);

		TableTypeBean tableType = new TableTypeBean();
		tableType.setId(query.getInt(columnId));
		tableType.setName(query.getString(columnName));
		return tableType;
	}

	@Override
	public ContentValues deconstruct(TableTypeBean track) {
		ContentValues values = new ContentValues();
		values.put(TRACK_ID, track.getId());
		values.put(TRACK_NAME, track.getName());
		return values;
	}

}
